home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue67 / construc / CClient.dpr < prev    next >
Encoding:
Text File  |  2001-01-31  |  1.7 KB  |  73 lines

  1. program CClient;
  2. {$DEFINE CALLBACK}
  3. {$APPTYPE CONSOLE}
  4. uses
  5.   SysUtils,
  6.   CORBA,
  7.   DrBob42_c in 'DrBob42_c.pas',
  8.   DrBob42_i in 'DrBob42_i.pas',
  9.   DrBob42_s, Rates_impl;
  10.  
  11. var
  12.   Rate: Rates; // skeleton object
  13.   Account: Accounts; // skeleton object
  14.  
  15.   procedure AccountArrayTest;
  16.   var
  17.     MyAccounts: AccountArray;
  18.   begin
  19.     MyAccounts[0] := TNormalOrSavingAccount.Create;
  20.     MyAccounts[0].accountN := TNormalAccount.Create(7); // normal
  21.     MyAccounts[1] := TNormalOrSavingAccount.Create;
  22.     MyAccounts[1].accountN := TNormalAccount.Create(42); // normal
  23.     MyAccounts[2] := TNormalOrSavingAccount.Create;
  24.     MyAccounts[2].accountS := TSavingAccount.Create(42,Rate); // saving
  25.     Account.AccountArrayTest(MyAccounts);
  26.   end;
  27.  
  28.   procedure AccountSequenceTest;
  29.   var
  30.     MyAccounts: AccountSequence;
  31.   begin
  32.     SetLength(MyAccounts,2);
  33.     MyAccounts[0] := TNormalOrSavingAccount.Create;
  34.     MyAccounts[0].accountN := TNormalAccount.Create(7); // normal
  35.     MyAccounts[1] := TNormalOrSavingAccount.Create;
  36.     MyAccounts[1].accountS := TSavingAccount.Create(42,Rate); // saving
  37.     Account.AccountSequenceTest(MyAccounts);
  38.   end;
  39.  
  40.  
  41. var
  42.   R: Integer;
  43. begin
  44.   CorbaInitialize;
  45. {$IFDEF CALLBACK}
  46.   Rate := TRatesSkeleton.Create('Rates', TRates.Create);
  47.   BOA.ObjIsReady(Rate as _Object);
  48. {$ENDIF}
  49.   write('Rate:');
  50.   readln(R);
  51.   try
  52.     // Add CORBA client Code Here
  53.   {$IFNDEF CALLBACK}
  54.     Rate := TRatesHelper.Bind;
  55.   {$ENDIF}
  56.     Rate.SetRate(R);
  57.     Account := TAccountsHelper.Bind;
  58.  
  59.     write('->');
  60.     readln;
  61.     AccountArrayTest;
  62.     write('+>');
  63.     readln;
  64.     AccountSequenceTest;
  65.   except
  66.     on E: Exception do
  67.       writeln(E.Message)
  68.   end;
  69.   write('=> ');
  70.   readln;
  71. end.
  72.  
  73.